﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IntegerArray
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("输入整数数组，用空格分隔各数：");
            string input = Console.ReadLine();
            try
            {
                ExtendedArray array = new ExtendedArray(Array.ConvertAll(input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), int.Parse));
                StringBuilder s = new StringBuilder();
                s.Append($"最大值：{array.Max()}\n");
                s.Append($"最小值：{array.Min()}\n");
                s.Append($"平均值：{array.Average()}\n");
                s.Append($"总和：{array.Sum()}");
                Console.WriteLine(s);
            }
            catch
            {
                Console.WriteLine("ERROR");
            }
            finally
            {
                Console.ReadKey();
            }
        }
    }
}
